﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WpfControlDemo.Models;
using WpfControlDemo.ViewModels;

namespace WpfControlDemo.数据绑定
{
    /// <summary>
    /// DataBindingWindow2.xaml 的交互逻辑
    /// </summary>
    public partial class DataBindingWindow2 : Window
    {
        public DataBindingWindow2()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Window2ViewModel vm = new Window2ViewModel();  // 业务对象
            this.DataContext = vm; // 绑定

            lbList2.DataContext = vm.ClassList; // 控件单独绑定
        }
    }
}
